<div id="content">
#{form @ManageRequestType.save(post?.id)}
 #{if flash.error}
    <p class="error">&{'managerequesttype.error.emptydescription'}</p>
 #{/if}
 #{if flash.success}
    <p class="success">${flash.success}</p>
 #{/if}
<table class="tableau">
	<tr>
		<td>
			<label for="id">&{'table.requesttype.id'}</label>
		
		</td>
		<td>
			<input type="text" id="idType" disabled=true value="${requestType?.getId()}" />
		</td>
	</tr>
	<tr>
		<td>
			<label for="description">&{'table.requesttype.describe'}</label>
		</td>
		<td>
			<input type="text" name="describe" id="describe" size="30" value="${requestType?.getDescription()}" />
		</td>
	</tr>
	<tr>
	<td colspan="2">
		<a id="add" href="#">&{'managerequesttype.addedit'}</a>
		<a id="delete" href="#">&{'managerequesttype.delete'}</a>
		<a id="cancel" href="#">&{'managerequesttype.cancel'}</a>
	</td>
	</tr>
</table>
#{/form}
</div>
<script>
	$(function() {
		
		$("#add").button().click(function() {
			// Define Create Action
			var createAction = #{jsAction @ManageRequestType.save(':id',':description') /}
			
			// Call Create Action
			$.post(createAction({id: $('#idType').val(), description: $('#describe').val()}), function(data) {
				// Prepend Results to the List
				$('#content').replaceWith(data);
				
			});
			});
				
		
		
		$("#delete").button().click(function() {
			// Define delete Action
			var createAction = #{jsAction @ManageRequestType.deleteRequestType(':requestId') /}
			// Call Create Action
			$.post(createAction({requestId:$('#idType').val()}), function(data) {
				// Prepend Results to the List
				$('#content').replaceWith(data);
			});
				
		});

		$("#cancel").button().click(function() {
			// Define Cancel Action
			var createAction = #{jsAction @index() /}
			// Call Cancel Action
			$.post(createAction(), function(data) {
				// Prepend Results to the List
				
				$('#content').replaceWith(data);
			});
				
		});
		
		
		
	});
</script>